package myTCPTest;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.Socket;

public class CelientDemo {
    public static void main(String[] args) throws IOException {
        // 创建客户端Socket对象
        Socket s = new Socket("172.19.17.207", 12345);

        // 获取输出流对象
        OutputStream os = s.getOutputStream();
        os.write("hello...".getBytes());

        // 接收服务器反馈
        InputStream in = s.getInputStream();
        byte[] bys = new byte[1024];
        int len = in.read(bys);
        System.out.println("客户端：" + new String(bys, 0, len));

        s.close();
    }
}
